#ifndef _WX_PROPGRID_ADVPROPS_H_
#define _WX_PROPGRID_ADVPROPS_H_

#ifdef DOXYGEN
#define wxUSE_IMAGE 1
#define wxUSE_CHOICEDLG 1
#define wxUSE_DATETIME 1
#else

#ifndef wxPG_INCLUDE_ADVPROPS
#error "Include propgrid.h"
#endif

#endif

#include "props.h"

#ifndef SWIG
bool WXDLLIMPEXP_PG operator == ( const wxArrayInt& array1, const wxArrayInt& array2 );
WX_PG_DECLARE_EDITOR_WITH_DECL( SpinCtrl, WXDLLIMPEXP_PG )
WX_PG_DECLARE_EDITOR_WITH_DECL( DatePickerCtrl, WXDLLIMPEXP_PG )

#endif

#define wxPG_COLOUR_WEB_BASE        0x10000
#define wxPG_COLOUR_CUSTOM      0xFFFFFF
#define wxPG_COLOUR_UNSPECIFIED (wxPG_COLOUR_CUSTOM+1)

class WXDLLIMPEXP_PG wxColourPropertyValue : public wxObject {
  public:

    wxUint32    m_type;
    wxColour    m_colour;

    wxColourPropertyValue()
      : wxObject() {
      m_type = 0;
    }

    wxColourPropertyValue( const wxColourPropertyValue& v )
      : wxObject() {
      m_type = v.m_type;
      m_colour = v.m_colour;
    }

    virtual ~wxColourPropertyValue() {
    }

    void Init( wxUint32 type, const wxColour& colour ) {
      m_type = type;
      m_colour = colour;
    }

    wxColourPropertyValue( const wxColour& colour )
      : wxObject() {
      m_type = wxPG_COLOUR_CUSTOM;
      m_colour = colour;
    }

    wxColourPropertyValue( wxUint32 type )
      : wxObject() {
      m_type = type;
    }

    wxColourPropertyValue( wxUint32 type, const wxColour& colour )
      : wxObject() {
      Init( type, colour );
    }

    #ifndef SWIG

    void operator= ( const wxColourPropertyValue& cpv ) {
      Init( cpv.m_type, cpv.m_colour );
    }

  private:
    DECLARE_DYNAMIC_CLASS( wxColourPropertyValue )
    #endif
};

#ifndef SWIG
bool WXDLLIMPEXP_PG operator == ( const wxColourPropertyValue&, const wxColourPropertyValue& );

WX_PG_DECLARE_WXOBJECT_VARIANT_DATA( wxPGVariantDataColourPropertyValue, wxColourPropertyValue, WXDLLIMPEXP_PG )
#endif

#ifndef SWIG
#define wxPG_EMPTY_CPV          (*((wxColourPropertyValue*)NULL))
#define wxPG_NORMAL_FONT        (*wxNORMAL_FONT)
#else
#define wxPG_EMPTY_CPV          wxCPV_wxPG_EMPTY
#define wxPG_NORMAL_FONT        wxFONT_wxPG_NORMAL_FONT
#endif

#if wxUSE_IMAGE || defined(SWIG)
#include <wx/image.h>
#endif

class WXDLLIMPEXP_PG wxFontProperty : public wxPGProperty {
    WX_PG_DECLARE_PROPERTY_CLASS( wxFontProperty )
  public:

    wxFontProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL, const wxFont& value = wxFont() );
    virtual ~wxFontProperty();
    virtual void OnSetValue();
    virtual wxString GetValueAsString( int argFlags = 0 ) const;

    WX_PG_DECLARE_EVENT_METHODS()
    WX_PG_DECLARE_PARENTAL_METHODS()

  protected:
};

#define wxPG_PROP_TRANSLATE_CUSTOM      wxPG_PROP_CLASS_SPECIFIC_1

class WXDLLIMPEXP_PG wxSystemColourProperty : public wxEnumProperty {
    WX_PG_DECLARE_PROPERTY_CLASS( wxSystemColourProperty )
  public:

    wxSystemColourProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
                            const wxColourPropertyValue& value = wxColourPropertyValue() );
    ~wxSystemColourProperty();

    virtual void OnSetValue();
    virtual bool IntToValue( wxVariant& variant, int number, int argFlags = 0 ) const;
    virtual wxString ColourToString( const wxColour& col, int index ) const;
    virtual int GetCustomColourIndex() const;
    WX_PG_DECLARE_BASIC_TYPE_METHODS()
    WX_PG_DECLARE_EVENT_METHODS()
    WX_PG_DECLARE_ATTRIBUTE_METHODS()
    WX_PG_DECLARE_CUSTOM_PAINT_METHODS()
    bool QueryColourFromUser( wxVariant& variant ) const;
    virtual wxColour GetColour( int index ) const;
    wxColourPropertyValue GetVal( const wxVariant* pVariant = NULL ) const;
  protected:
    wxSystemColourProperty( const wxString& label, const wxString& name, const wxChar** labels,
                            const long* values, wxPGChoices* choicesCache, const wxColourPropertyValue& value );
    wxSystemColourProperty( const wxString& label, const wxString& name, const wxChar** labels,
                            const long* values, wxPGChoices* choicesCache, const wxColour& value );

    void Init( int type, const wxColour& colour );
    virtual wxVariant DoTranslateVal( wxColourPropertyValue& v ) const;
    wxVariant TranslateVal( wxColourPropertyValue& v ) const {
      return DoTranslateVal( v );
    }
    wxVariant TranslateVal( int type, const wxColour& colour ) const {
      wxColourPropertyValue v( type, colour );
      return DoTranslateVal( v );
    }
    int ColToInd( const wxColour& colour ) const;
};

WX_PG_DECLARE_CUSTOM_COLOUR_PROPERTY_USES_WXCOLOUR_WITH_DECL( wxColourProperty, class WXDLLIMPEXP_PG )

class WXDLLIMPEXP_PG wxCursorProperty : public wxEnumProperty {
    DECLARE_DYNAMIC_CLASS( wxCursorProperty )
    wxCursorProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL, int value = 0 );
    virtual ~wxCursorProperty();
    WX_PG_DECLARE_CUSTOM_PAINT_METHODS()

};

WXDLLIMPEXP_PG const wxString& wxPGGetDefaultImageWildcard();

class WXDLLIMPEXP_PG wxImageFileProperty : public wxFileProperty {
    DECLARE_DYNAMIC_CLASS( wxImageFileProperty )
  public:
    wxImageFileProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
                         const wxString& value = wxEmptyString );
    virtual ~wxImageFileProperty();
    virtual void OnSetValue();
    WX_PG_DECLARE_CUSTOM_PAINT_METHODS()
  protected:
    wxBitmap*   m_pBitmap;
    wxImage*    m_pImage;
};


#if wxUSE_CHOICEDLG || defined(SWIG)

class WXDLLIMPEXP_PG wxMultiChoiceProperty : public wxPGProperty {
    WX_PG_DECLARE_PROPERTY_CLASS( wxMultiChoiceProperty )
  public:

    wxMultiChoiceProperty( const wxString& label, const wxString& name, const wxArrayString& strings,
                           const wxArrayString& value );
    #ifndef SWIG
    wxMultiChoiceProperty( const wxString& label, const wxString& name, const wxPGChoices& choices,
                           const wxArrayString& value = wxArrayString() );
    wxMultiChoiceProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
                           const wxArrayString& value = wxArrayString() );
    #endif
    virtual ~wxMultiChoiceProperty();

    virtual void OnSetValue();
    virtual wxString GetValueAsString( int flags = 0 ) const;
    virtual bool StringToValue( wxVariant& variant, const wxString& text, int argFlags = 0 ) const;
    WX_PG_DECLARE_EVENT_METHODS()
    virtual int GetChoiceInfo( wxPGChoiceInfo* choiceinfo );
    wxArrayInt GetValueAsArrayInt() const {
      return m_choices.GetValuesForStrings( m_value.GetArrayString() );
    }
  protected:
    void GenerateValueAsString();
    wxArrayInt GetValueAsIndices() const;
    wxArrayString m_valueAsStrings;
    wxPGChoices m_choices;
    wxString m_display;
};

#endif

#if wxUSE_DATETIME || defined(SWIG)

class WXDLLIMPEXP_PG wxDateProperty : public wxPGProperty {
    WX_PG_DECLARE_PROPERTY_CLASS( wxDateProperty )
  public:
    wxDateProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL,
                    const wxDateTime& value = wxDateTime() );
    virtual ~wxDateProperty();
    virtual void OnSetValue();
    virtual wxString GetValueAsString( int flags = 0 ) const;
    virtual bool StringToValue( wxVariant& variant, const wxString& text, int argFlags = 0 ) const;
    WX_PG_DECLARE_ATTRIBUTE_METHODS()
    void SetFormat( const wxString& format ) {
      m_format = format;
    }
    const wxString& GetFormat() const {
      return m_format;
    }
    void SetDateValue( const wxDateTime& dt ) {
      m_value = dt;
    }

    wxDateTime GetDateValue() const {
      return m_value;
    }

    long GetDatePickerStyle() const {
      return m_dpStyle;
    }
  protected:
    wxString        m_format;
    long            m_dpStyle;
    static wxString ms_defaultDateFormat;
    static wxString DetermineDefaultDateFormat( bool showCentury );
};

#endif

#include <wx/spinbutt.h>
#include "editors.h"

class WXDLLIMPEXP_PG wxPGSpinCtrlEditor : public wxPGTextCtrlEditor {
    WX_PG_DECLARE_EDITOR_CLASS( wxPGSpinCtrlEditor )
  public:
    virtual ~wxPGSpinCtrlEditor();
    wxPG_DECLARE_CREATECONTROLS
    virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property, wxWindow* wnd, wxEvent& event ) const;
  private:
    mutable wxString m_tempString;
};

#endif
